﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="fhdb" content="true">
    <title>个人中心</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/personalCenter.css">
    <link rel="stylesheet" href="css/Navigation.css">
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.qrcode.min.js"></script>
</head>
<body>
    <div class="phoneError">
    </div>
    <div class="topTitle">
        个人中心
    </div>
    <div class="userName">
        <img src="images/touxiang.png" alt="">
        <div>
            <p id="TB_USERNAME">
            </p>
            <p id="TB_PHONE">
            </p>
        </div>
        <span class="glyphicon glyphicon-eye-close" id="eyeopen"></span>
        <span style="display:none" class="glyphicon glyphicon-eye-open" id="eyecloseopen"></span>
    </div>
    <!-- 遮罩层 -->
    <div class="cover">
    </div>
    <div class="bigInvitationBox">
        <p>
            邀请
        </p>
        <div id="qrcode">
        </div>
        <p>
            请截图进行保存
        </p>
        <div class="line">
        </div>
        <p class="confirm">
            确认
        </p>
    </div>
    <!-- 提现 -->
    <div class="covers">
    </div>
    <div class="bigWithdrawalBox">

        <div>
            <span>余额：￥</span> <span class="price"></span>
        </div>
        <div>
            <span>*提现金额：</span>
            <input type="text" placeholder="请输入提现金额" onkeyup="clearNoNum(this)" id="txprice">
        </div>
        <p>
            1、提现需满100元<br />
            2、提现扣除10%手续费<br />
            3、提现后3-5个工作日到账<br />
            4、请务必将支付授权信息填写正确
        </p>
        <div>
            <button class="cancel-withdrawal">
                取消
            </button>
            <button class="confirm-withdrawal">
                确认
            </button>
        </div>
    </div>
    <!-- 导航栏 -->
    <nav class="navbar navbar-default navbar-fixed-bottom">
        <div class="container">
            <div class="nav-item home">
                <span class="glyphicon glyphicon-home">
                    <span>
                        <div>首页</div>
            </div>
            <div class="nav-item order">
                <span class="glyphicon glyphicon-list">
                    <span>
                        <div>订单</div>
            </div>
            <div class="nav-item mine active">
                <span class="glyphicon glyphicon-user">
                    <span>
                        <div>我</div>
            </div>
        </div>
    </nav>
    <!-- 应用 -->
    <div class="applicationBox">
        <div class="application invitation">
            <img src="images/QRcode.png" alt="">
            <p>
                邀请
            </p>
        </div>
        <div class="application commission">
            <img src="images/tx.png" alt="">
            <p>
                佣金
            </p>
        </div>
        <div class="application withdrawal">
            <img src="images/rmb.png" alt="">
            <p>
                提现
            </p>
        </div>
        <div class="application helpCenter">
            <img src="images/atm-fill.png" alt="">
            <p>
                帮助中心
            </p>
        </div>
    </div>
    <div class="applicationBox">
        <div class="application zfbEmpower">
            <img src="images/sq.png" alt="">
            <p>
                支付授权
            </p>
        </div>
        <div class="application address">
            <img src="images/home.png" alt="">
            <p>
                地址管理
            </p>
        </div>
        <div class="application authentication">
            <img src="images/user.png" alt="">
            <p>
                实名认证
            </p>
        </div>
        <div class="application withdrawalList">
            <img src="images/viewlist.png" alt="">
            <p>
                提现列表
            </p>
        </div>
    </div>
    <div class="applicationBox">
        <div class="application myFriends">
            <img src="images/txl.png" alt="">
            <p>
                我的好友
            </p>
        </div>
        <div class="application distributionOrder">
            <img src="images/flow.png" alt="">
            <p>
                分销订单
            </p>
        </div>
        <div class="application">

        </div>
        <div class="application">
        </div>
    </div>
    <div class="space1">
    </div>
    <div class="passwordBox">
        <div class="changePassword">
            修改密码
        </div>
        <div class="signOut">
            退出登录
        </div>
    </div>
    <div class="space">
    </div>
</body>
<script>
    var number = "";
    var phone = "";
    $(function () {
        $(".signOut").click(function () {
            window.location.href = "../UserLogin/Login.html";
        })
        $.ajax({
            type: "post",
            url: "../../BaseRefWeb.aspx?stype=ISpMemberFun&method=GetIDCard&type=sp",
            success: function (result) {
                if (result != "") {
                    var data = JSON.parse(result);
                    if (data.msg == "_timeout") {
                        window.location.href = "../UserLogin/Login.html";
                    }
                    else {
                        $("#TB_USERNAME").text(data.TB_USERNAME);
                        $("#TB_PHONE").text(data.TB_NUMBER);
                        number = data.TB_NUMBER.replace(" ", "");
                        phone = data.TB_PHONE;
                    }
                }
            }
        });
    })
    $(document).ready(function () {
        $('.container').on('click', '.nav-item', function () {
            const $this = $(this)
            const index = $this.index()
            $this.addClass('active').siblings().removeClass('active')
            switch (index) {
                case 0:
                    location.href = '../../rushBuy.html';
                    break
                case 1:
                    location.href = '../shop/order.html';
                    break
                case 2:
                    location.href = 'personalCenter.html';
                    break
            }
        })
        // 二维码
        $(".invitation").click(function () {
            $("#qrcode").html("");
            $('#qrcode').qrcode({
                render: "canvas", //也可以替换为table
                width: 150,
                height: 150,
                text: "http://www.xiangpaipai.com/Manage/UserLogin/Register.html?number=" + number + ""
            });
            $(".cover").toggle()
            $(".bigInvitationBox").toggle()
        })
        $(".confirm").click(function () {
            $(".cover").toggle()
            $(".bigInvitationBox").toggle()
        })
        // 跳转到佣金列表
        $(".commission").click(function () {
            location.href = 'commission.html';
        })
        // 提现
        $(".withdrawal").click(function () {
            $.ajax({
                type: "post",
                url: "../../BaseRefWeb.aspx?stype=ISpMemberFun&method=GetZfYuE&type=sp",
                success: function (result) {
                    if (result != "") {
                        var data = JSON.parse(result);
                        if (data.msg == "_timeout") {
                            window.location.href = "../UserLogin/Login.html";
                        }
                        else {
                            $(".price").text(data);
                        }
                    }
                }
            });
            $(".covers").toggle()
            $(".bigWithdrawalBox").toggle()
        })
        $(".cancel-withdrawal").click(function () {
            $(".covers").toggle()
            $(".bigWithdrawalBox").toggle()
        })
        $(".confirm-withdrawal").click(function () {
            $.ajax({
                type: "post",
                data: { TB_TX_PRICE: $("#txprice").val() },
                url: "../../BaseRefWeb.aspx?stype=ISpWithdrawFun&method=DoWebSave&type=sp",
                success: function (result) {
                    var data = JSON.parse(result);
                    if (data.msg == "_timeout") {
                        window.location.href = "../UserLogin/Login.html";
                    }
                    else {
                        $('.phoneError').text(data.msg);
                        var top = ($(window).height() - $('.phoneError').height()) / 2;
                        var left = ($(window).width() - $('.phoneError').width()) / 2;
                        var scrollTop = $(document).scrollTop();
                        var scrollLeft = $(document).scrollLeft();
                        $('.phoneError').css({ position: 'absolute', 'top': top + scrollTop, left: left + scrollLeft }).show();
                        setTimeout(function () {
                            $('.phoneError').hide();
                            $(".covers").toggle()
                            $(".bigWithdrawalBox").toggle()
                        }, 2000)
                    }
                }
            });
        })
        // 支付认证
        $(".zfbEmpower").click(function () {
            location.href = 'zfbEmpower.html';
        })
        // 地址管理
        $(".address").click(function () {
            location.href = 'address.html';
        })
        // 实名认证
        $(".authentication").click(function () {
            location.href = 'authentication.html';
        })
        // 提现列表
        $(".withdrawalList").click(function () {
            location.href = 'withdrawalList.html';
        })
        // 我的好友
        $(".myFriends").click(function () {
            location.href = 'myFriends.html';
        })
        // 分销订单
        $(".distributionOrder").click(function () {
            location.href = 'distributionOrder.html';
        })
        // 帮助中心
        $(".helpCenter").click(function () {
            location.href = 'helpCenter.html';
        })
        //修改密码
        $(".changePassword").click(function () {
            location.href = '../UserLogin/Revise.html';
        })
        //关闭手机号
        $("#eyeopen").click(function () {
            $("#TB_PHONE").text("xxxxxxxxxxx");
            $("#eyecloseopen").show();
            $("#eyeopen").hide();
        })
        $("#eyecloseopen").click(function () {
            $("#TB_PHONE").text(number);
            $("#eyecloseopen").hide();
            $("#eyeopen").show();
        })
    });
    function clearNoNum(obj) {
        obj.value = obj.value.replace(/[^\d.]/g, "");  //清除“数字”和“.”以外的字符
        obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
        obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');//只能输入两个小数
        if (obj.value.indexOf(".") < 0 && obj.value != "") {//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
            obj.value = parseFloat(obj.value);
        }
    }
</script>
</html>
